const Hapi = require('hapi');
require('env2')('./.env');
const config=require("./config/index");
// const routesHelloHapi=require("./src/routes/hello-world");
const routesOrders=require("./routes/orders")
const routessShops=require("./routes/shops")
// 引入自定义的 hapi-swagger 插件配置
const pluginHapiSwagger = require('./plugins/hapi-swagger');

const server = new Hapi.Server()

server.connection({
    port:config.port,
    host:config.host
})
const init = async () => {
await server.register([
     // 为系统使用 hapi-swagger
    ...pluginHapiSwagger,
])
  server.route([...routesOrders,...routessShops]);

  await server.start();
  console.log(`server running at :${server.info.uri}`)
};
init()
// --env production